################################################################################
#	Copyright (c) 2012 Robotnik Automation, SLL
#       Makefile for GUI-2 package
################################################################################


############################################ SKYPE ############################# 

INC_DEBUG = -I$(SKYPE_KIT_ROOT)interfaces/skype/cpp_embedded/src/api -I$(SKYPE_KIT_ROOT)interfaces/skype/cpp_embedded/src/ipc -I$(SKYPE_KIT_ROOT)interfaces/skype/cpp_embedded/src/types -I$(SKYPE_KIT_ROOT)interfaces/skype/cpp_embedded/src/platform/threading -I$(SKYPE_KIT_ROOT)ipc/cpp -I$(SKYPE_KIT_ROOT)ipc/cpp/platform/se -I$(SKYPE_KIT_ROOT)ipc/cpp/ssl/cyassl/include -I$(SKYPE_KIT_ROOT)ipc/cpp/ssl/cyassl/ctaocrypt/include -I$(SKYPE_KIT_ROOT)ipc/cpp/ssl/cyassl/include/openssl -I$(SKYPE_KIT_ROOT)interfaces/skype/cpp_embedded/src/platform/threading/pthread -I$(SKYPE_KIT_ROOT)examples/cpp/tutorial/keypair

CFLAGS = -Winvalid-pch -DWX_PRECOMP 
CFLAGS_DEBUG =  $(CFLAGS) -Wall -g -DSSL_LIB_CYASSL -DNO_FILESYSTEM 

LIBDIR_DEBUG =  -L$(SKYPE_KIT_ROOT)interfaces/skype/cpp_embedded/build -L$(SKYPE_KIT_ROOT)bin/linux-x86
LIB_DEBUG = $(SKYPE_KIT_ROOT)interfaces/skype/cpp_embedded/build/libskypekit-cppwrapper_2_lib.a $(SKYPE_KIT_ROOT)interfaces/skype/cpp_embedded/build/libskypekit-cyassl_lib.a
 

SKYPE_CFLAGS = $(CFLAGS_DEBUG) $(INC_DEBUG) 
SKYPE_LFLAGS = $(LIBDIR_DEBUG) $(LIB_DEBUG)

############################################ /SKYPE ############################



WXFLAGS	 = `wx-config --cflags`
WXLIB    = `wx-config --libs`

ROSCFLAGS = `rospack export --lang=cpp --attrib=cflags GUI-2`
ROSLFLAGS = `rospack export --lang=cpp --attrib=lflags GUI-2`


EXE		= gui-2
BUILD		= ./build/
BINDIR		= ./bin/
SRC		= ./
SRC2		= ./src/
LIB 		= ./lib/
LIBS		= -L$(LIB)
INC		= ./
INC2		= ./include/
INCS		= -I$(INC) -I$(INC2)

CPP		= g++
CCFLAGS	        = -c -fpic -Wno-deprecated 

OBJECTS =	\
			$(BUILD)GUI_2App.o \
			$(BUILD)GUI_2Main.o \
			$(BUILD)ProcessManager.o \
			$(BUILD)ObjectInfo.o \
			$(BUILD)SkypeFunctions.o \
			$(BUILD)SkypeWindow.o \
			$(BUILD)SkypeWindow2.o \
			$(BUILD)RosInterface.o 

default: $(BINDIR)$(EXE)

all: $(BINDIR)$(EXE)

$(BUILD)GUI_2App.o : $(SRC)GUI_2App.cpp
	$(CPP) $(CCFLAGS) $(INCS) $(ROSCFLAGS) $(WXFLAGS) $(SKYPE_CFLAGS) -o $(BUILD)GUI_2App.o $(SRC)GUI_2App.cpp

$(BUILD)GUI_2Main.o : $(SRC)GUI_2Main.cpp
	$(CPP) $(CCFLAGS) $(INCS) $(ROSCFLAGS) $(WXFLAGS) $(SKYPE_CFLAGS) -o $(BUILD)GUI_2Main.o $(SRC)GUI_2Main.cpp

$(BUILD)ObjectInfo.o : $(SRC)ObjectInfo.cpp
	$(CPP) $(CCFLAGS) $(INCS) $(ROSCFLAGS) $(WXFLAGS) -o $(BUILD)ObjectInfo.o $(SRC)ObjectInfo.cpp

$(BUILD)ProcessManager.o : $(SRC2)ProcessManager.cc
	$(CPP) $(CCFLAGS) $(INCS)  -o $(BUILD)ProcessManager.o $(SRC2)ProcessManager.cc

$(BUILD)RosInterface.o : $(SRC2)RosInterface.cpp
	$(CPP) $(CCFLAGS) $(ROSCFLAGS) $(INCS)  $(WXFLAGS) -o $(BUILD)RosInterface.o $(SRC2)RosInterface.cpp

$(BUILD)SkypeFunctions.o : $(SRC2)SkypeFunctions.cpp
	$(CPP) $(CCFLAGS) $(INCS) $(WXFLAGS) $(SKYPE_CFLAGS) -o $(BUILD)SkypeFunctions.o $(SRC2)SkypeFunctions.cpp

$(BUILD)SkypeWindow.o : $(SRC)SkypeWindow.cpp
	$(CPP) $(CCFLAGS) $(INCS) $(ROSCFLAGS) $(WXFLAGS) $(SKYPE_CFLAGS) -o $(BUILD)SkypeWindow.o $(SRC)SkypeWindow.cpp

$(BUILD)SkypeWindow2.o : $(SRC)SkypeWindow2.cpp
	$(CPP) $(CCFLAGS) $(INCS) $(ROSCFLAGS) $(WXFLAGS) $(SKYPE_CFLAGS) -o $(BUILD)SkypeWindow2.o $(SRC)SkypeWindow2.cpp

$(BINDIR)$(EXE) : $(OBJECTS)
	$(CPP) -Wall  $(INCS) -o $(BINDIR)$(EXE) $(OBJECTS) $(LIBS) $(WXLIB) $(ROSLFLAGS) $(SKYPE_LFLAGS)

clean:
	rm -fv $(BUILD)*.o
	rm -fv $(BINDIR)$(EXE)

cleanall:
	rm -fv $(BUILD)*.o
	rm -fv $(BINDIR)$(EXE)
